//
//  CommentTextCell.m
//  WE
//
//  Created by iMacOne on 15/11/20.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "CommentTextCell.h"
#import "Size.h"
#import "ToolUtil.h"
#define TITLECOLOR [UIColor colorWithRed:74/255.0 green:104/255.0 blue:241/255.0 alpha:1.0]
@interface CommentTextCell ()
@property (nonatomic, strong)UILabel * titleLbl;
@property (nonatomic, strong)UILabel * startLbl;
@property (nonatomic, strong)UILabel * contentLbl;
@property (nonatomic, strong)UILabel * nameLbl;
@property (nonatomic, strong)UILabel * stautLbl;
@property (nonatomic, strong)UILabel * timeLbl;


@end
@implementation CommentTextCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.titleLbl = [[UILabel alloc] initWithFrame:CGRectMake(margin_10, margin_10, margin_100, margin_20)];
        _titleLbl.text = @"问题不大";
        _titleLbl.font = FONT(14);
        _titleLbl.textColor = TITLECOLOR;
        
        self.startLbl = [[UILabel alloc] initWithFrame:CGRectMake(WindowWidth - margin_140, margin_10, margin_140, margin_20)];
        _startLbl.text = @"⭐️⭐️⭐️⭐️⭐️⭐️";
        _startLbl.font = FONT(13);
        _startLbl.textColor = [UIColor orangeColor];
        
        self.contentLbl = [[UILabel alloc] initWithFrame:CGRectMake(margin_10, CGRectGetMaxY(_titleLbl.frame) + 5, WindowWidth - 20,[ToolUtil customAutoHeigh:@"软件默认候诊人是注册人 妈妈的复诊搞错成我了 挂号时才发现 差点爽约 大家今后务必注意啊 正如那个医生判断的一样啊 并没有什么问题了" width:WindowWidth - 20 num:13])];
        _contentLbl.numberOfLines = 0;
        _contentLbl.textColor = CONTENTCOLOR;
        _contentLbl.text = @"软件默认候诊人是注册人 妈妈的复诊搞错成我了 挂号时才发现 差点爽约 大家今后务必注意啊 正如那个医生判断的一样啊 并没有什么问题了";
        _contentLbl.font = FONT(13);
//        _titleLbl.textColor = [UIColor blueColor];
        
        self.nameLbl = [[UILabel alloc] initWithFrame:CGRectMake(margin_10, CGRectGetMaxY(_contentLbl.frame) + 10, 60, margin_20)];
        _nameLbl.text = @"丁叉叉";
        _nameLbl.textColor = CONTENTCOLOR;

        _nameLbl.font = FONT(14);
//        _nameLbl.textColor = [UIColor blueColor];
        
        self.stautLbl = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_nameLbl.frame) + 3, CGRectGetMaxY(_contentLbl.frame) + 10, 40, margin_20)];
        _stautLbl.text = @"   就诊";
//        _startLbl.textAlignment = NSTextAlignmentCenter;
        _stautLbl.font = FONT(12);
        _stautLbl.textColor = CONTENTCOLOR;
//        _startLbl.numberOfLines = 0;
        _stautLbl.layer.borderWidth = 0.5;
        _stautLbl.layer.borderColor = [UIColor grayColor].CGColor;
        _stautLbl.layer.masksToBounds = YES;
        _stautLbl.layer.cornerRadius = 2;

//        _titleLbl.textColor = [UIColor blueColor];
        
        self.timeLbl = [[UILabel alloc] initWithFrame:CGRectMake(WindowWidth - 90, CGRectGetMaxY(_contentLbl.frame) + 10, 90, margin_20)];
        _timeLbl.text = @"2015.11.31";
        _timeLbl.font = FONT(14);
        _timeLbl.textColor = [UIColor grayColor];
        
        [self.contentView addSubview:_timeLbl];
        [self.contentView addSubview:_contentLbl];
        [self.contentView addSubview:_titleLbl];
        [self.contentView addSubview:_nameLbl];
        [self.contentView addSubview:_stautLbl];
        [self.contentView addSubview:_startLbl];

    }
    return self;
}
+ (CGFloat)cellHeight
{
    NSString *str = @"软件默认候诊人是注册人 妈妈的复诊搞错成我了 挂号时才发现 差点爽约 大家今后务必注意啊 正如那个医生判断的一样啊 并没有什么问题了" ;
    CGRect rect = [str boundingRectWithSize:CGSizeMake(WindowWidth - 20, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:FONT(13)} context:nil];
    return  80 + rect.size.height;
    
}

@end
